<template>
	<div class="info_wrapper">
		<div v-if="headIos" style="width: 100%; height: 20px;background: white;position: fixed;top: 0;"></div>
		<k-header headTitle="消息详情" goBack="true"></k-header>
		<div class="item" :class="headIos?'side-fixd-ios':'side-fixed'"
			@click="detailJump(detailDist.targetType,detailDist.isAuth,detailDist.parem1,detailDist.abnormalStatus,detailDist.isAuthPassed,detailDist.reportStatus)"
		>
			<div class="item_title">{{ messageList.content }}</div>
			<div class="item_time">{{ detailDist.createTime }}</div>
			<div class="item_content">{{ messageList.title }}</div>
		</div>
	</div>
</template>
<script>
import kHeader from '../common/head'
import util from '../../libs/util'
export default {
	data() {
		return {
			detailId: '',
			detailDist: '',
			headIos: false,
			messageList:''
		}
	},
	components: {
		kHeader
	},
	methods: {
		getdetail() {
			let that = this;
			// let url = 'lblsapp-h5/v2/index/queryMessageInfo.json';
			let url = '/lblsapp-h5/v2/index/messageDetail.json';
			let datas = {};
			datas.id = that.detailId;
			util.ajax.post(url, datas).then(function(stats) {
				console.log(stats,765);
				that.detailDist = stats.data.res.data;
				that.messageList = stats.data.res.data.messageInfo;
			}).catch(function(error) {
				console.log(error);
			})
		},
		detailJump(k, g, m,abnor,iaAuth,reportStatue) {  // 报告详情跳转
			console.log(k);
			if (k == "AUTHPASS") {
				this.$router.push('/startcheck'); // 开始背调页面不需要传参 认证通过
			} else if (k == 'AUTHUNPASS') {
				if (g == '1') {
					this.$router.push('/userInfo');//个人信息
				} else {
					this.$router.push('/userCertification');//个人认证
				}
			} else if (k == 'JOINCOP' || k == 'JOINCOPREGEST') {
				this.$router.push('/startcheck'); // 开始背调页面不需要传参
			} else if (k == 'REPORTPASSED') {
				// this.$router.push('/archieveDetails') // 报告详情
				if (iaAuth == '0') {
					if (reportStatue == 'PASSED') {
						this.$router.push({ path: "/archieveDetails", query: { id: m } });
					} else if (reportStatue == 'UNCOMMITTED') {
						this.$router.push('/startcheck');
					} else {
						this.$router.push({ path: "/abnoemal", query: { id: m } });
					}
				} else {
					this.$router.push({ path: "/abnoemal", query: { id: m } });
				}
			} else if ((k == "CONFIRMJOIN" || k == "CONFIRMRESIGNED" || k == "JOINLINKOVER") && (m != null || m != "")) {
				this.$router.push({ path: "/secretDetail", query: { workId: m } });
			}else if(k == "RPORTLINKOVER" || k=="REPORTUNAUTHPASS" || k=="REFUSERESIGNED" || k=="REFUSEJOIN" || k == "JOINLINKOVER" || k=="AUTHDISPASSED"){
				//异常报告
				this.$router.push({ path: "/abnoemal", query: { id: m } });
				
			}else if(k=='REPORTBATCHPASSED'){
				//批量报告跳转报告中心
				this.$router.push({ path: "/archivecenter"});
			} else if (k == 'UNJOINCOP' || k=="ACTIVITY" ||k=="OTHER") {
				// 等待设计图编辑 解绑企业 活动 其他
			} else if (k == "SHENDTOCOMPANYAUTH") {
				// 等待设计图编辑 发送管理员审核
			} else if (k == "CONFIRMJOIN" || k == "CONFIRMRESIGNED") {
				// 等待设计图编辑  员工确认入职  员工确认离职
			}
		}
	},
	created() {
		if (window.navigator.userAgent.indexOf('LBLSIOS') > -1) {
			this.headIos = true;
		}
		this.detailId = this.$route.query.num;
		this.getdetail();
	}
}
</script>

<style scoped>
.clearfix:after {
	display: block;
	height: 0;
	clear: both;
	overflow: hidden;
	visibility: hidden;
	content: '';
}

.info_wrapper {
	height: 100%;
	width: 100%;
	box-sizing: border-box;
	background: rgb(245, 245, 245);
	padding-top: 45px;
}

.item {
	margin-top: 10px;
	width: 100%;
	padding: 11px 37px 13px 16px;
	box-sizing: border-box;
	background: #FFFFFF;
	display: block;
}

.side-fixd-ios {
	margin-top: 30px;
}

.item_title {
	font-size: 1.4rem;
	color: #212121;
}

.item_time {
	margin-top: 5px;
	font-size: 1.2rem;
	color: #808080;
}

.item_content {
	margin-top: 12px;
	line-height: 20px;
	font-size: 1.4rem;
	color: #808080;
}
</style>
